/**
 * @description: SendRecordSrv
 */

import type { CommonAPI } from '../types/all'
import { defHttp } from '../http'

/** 删除域名 */
export const deleteDnsDomainApi: CommonAPI<'/v1/dns/domain', 'delete'> = data =>
  defHttp.delete(`/v1/dns/domain`, { data })

/** 创建域名 */
export const addDnsDomainApi: CommonAPI<'/v1/dns/domain', 'post'> = data =>
  defHttp.post(`/v1/dns/domain`, data)

/** 更新域名 */
export const updateDnsDomainApi: CommonAPI<'/v1/dns/domain', 'put'> = data =>
  defHttp.put(`/v1/dns/domain`, data)

/** 查询域名 */
export const getDnsDomainListApi: CommonAPI<
  '/v1/dns/domains',
  'get'
> = params => defHttp.get(`/v1/dns/domains`, { params })

/** 获取第三方DNS提供商的域名列表 */
export const getDnsProviderListApi: CommonAPI<
  '/v1/dns/provider/domains',
  'get'
> = params => defHttp.get(`/v1/dns/provider/domains`, { params })

/** 删除DNS账户 */
export const deleteDnAccountApi: CommonAPI<
  '/v1/dns/account',
  'delete'
> = data => defHttp.delete(`/v1/dns/account`, { data })

/** 创建DNS账户 */
export const addDnsAccountApi: CommonAPI<
  '/v1/dns/account/create',
  'post'
> = data => defHttp.post(`/v1/dns/account/create`, data)

/** 更新DNS账户 */
export const updateDnsAccountApi: CommonAPI<'/v1/dns/account', 'put'> = data =>
  defHttp.put(`/v1/dns/account`, data)

/** 查询DNS账户 */
export const getDnsAccountListApi: CommonAPI<
  '/v1/dns/accounts',
  'get'
> = params => defHttp.get(`/v1/dns/accounts`, { params })

// ------------------dns 域名解析
/**
 * @description: Domain
 */

/** Get 获取域名 */
export const getDnsAuthorityDomainApi: CommonAPI<
  '/v1/dnsauthority/domain',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/domain`, { params })

/** 删除域名 */
export const deleteDnsAuthorityDomainApi: CommonAPI<
  '/v1/dnsauthority/domain',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/domain`, { data })

/** 创建域名 */
export const addDnsAuthorityDomainApi: CommonAPI<
  '/v1/dnsauthority/domain',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/domain`, data)

/** 更新域名 */
export const updateDnsAuthorityDomainApi: CommonAPI<
  '/v1/dnsauthority/domain',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/domain`, data)

/** 检测域名的名称服务器接入状态 */
export const getDnsAuthorityDomainCheckNameserverStatusApi: CommonAPI<
  '/v1/dnsauthority/domain/check_nameserver_status',
  'get'
> = params =>
  defHttp.get(`/v1/dnsauthority/domain/check_nameserver_status`, { params })

/** 查询域名 */
export const getDnsAuthorityDomainsApi: CommonAPI<
  '/v1/dnsauthority/domains',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/domains`, { params })

/**
 * @description: Nameserver
 */

/** Get 获取NS地址 */
export const getDnsAuthorityNameserverApi: CommonAPI<
  '/v1/dnsauthority/nameserver',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/nameserver`, { params })

/** 删除NS地址 */
export const deleteDnsAuthorityNameserverApi: CommonAPI<
  '/v1/dnsauthority/nameserver',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/nameserver`, { data })

/** 创建NS地址 */
export const postDnsAuthorityNameserverApi: CommonAPI<
  '/v1/dnsauthority/nameserver',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/nameserver`, data)

/** 更新NS地址 */
export const updateDnsAuthorityNameserverApi: CommonAPI<
  '/v1/dnsauthority/nameserver',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/nameserver`, data)

/** 查询NS地址 */
export const getDnsAuthorityNameserversApi: CommonAPI<
  '/v1/dnsauthority/nameservers',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/nameservers`, { params })

/**
 * @description: dns Record
 */

/** 删除DNS记录 */
export const deleteDnsAuthorityRecordApi: CommonAPI<
  '/v1/dnsauthority/record',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/record`, { data })

/** 添加DNS记录 */
export const addDnsAuthorityRecordApi: CommonAPI<
  '/v1/dnsauthority/record',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/record`, data)

/** 更新DNS记录 */
export const updateDnsAuthorityRecordApi: CommonAPI<
  '/v1/dnsauthority/record',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/record`, data)

/** 获取DNS记录列表 */
export const getDnsAuthorityRecordsListApi: CommonAPI<
  '/v1/dnsauthority/records',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/records`, { params })

/**
 * @description: GTMInstance
 */

/** 获取GTM实例 */
export const getDnsAuthorityGtmInstanceApi: CommonAPI<
  '/v1/dnsauthority/gtm/instance',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/gtm/instance`, { params })

/** 删除GTM实例 */
export const deleteDnsAuthorityGtmInstanceApi: CommonAPI<
  '/v1/dnsauthority/gtm/instance',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/gtm/instance`, { data })

/** 创建GTM实例 */
export const addDnsAuthorityGtmInstanceApi: CommonAPI<
  '/v1/dnsauthority/gtm/instance',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/gtm/instance`, data)

/** 更新GTM实例 */
export const updateDnsAuthorityGtmInstanceApi: CommonAPI<
  '/v1/dnsauthority/gtm/instance',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/gtm/instance`, data)

/** 查询GTM实例 */
export const getDnsAuthorityGtmInstancesApi: CommonAPI<
  '/v1/dnsauthority/gtm/instances',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/gtm/instances`, { params })

/**
 * @description: GTMStrategy
 */

/** 查询GTM策略 */
export const getDnsAuthorityGtmStrategiesApi: CommonAPI<
  '/v1/dnsauthority/gtm/strategies',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/gtm/strategies`, { params })

/** 获取GTM策略 */
export const getDnsAuthorityGtmStrategyApi: CommonAPI<
  '/v1/dnsauthority/gtm/strategy',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/gtm/strategy`, { params })

/** 删除GTM策略 */
export const deleteDnsAuthorityGtmStrategyApi: CommonAPI<
  '/v1/dnsauthority/gtm/strategy',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/gtm/strategy`, { data })

/** 创建GTM策略 */
export const addDnsAuthorityGtmStrategyApi: CommonAPI<
  '/v1/dnsauthority/gtm/strategy',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/gtm/strategy`, data)

/** 更新GTM策略 */
export const updateDnsAuthorityGtmStrategyApi: CommonAPI<
  '/v1/dnsauthority/gtm/strategy',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/gtm/strategy`, data)

/**
 * @description: Line
 */

/** 查询 所有线路 */
export const getDnsAuthorityLinesApi: CommonAPI<
  '/v1/dnsauthority/lines',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/lines`, { params })

/**
 * @description: GTMAddressPool
 */

/** Get 获取地址池 */
export const getDnsAuthorityGtmAddressPoolApi: CommonAPI<
  '/v1/dnsauthority/gtm/address_pool',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/gtm/address_pool`, { params })

/** 删除地址池 */
export const deleteDnsAuthorityGtmAddressPoolApi: CommonAPI<
  '/v1/dnsauthority/gtm/address_pool',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/gtm/address_pool`, { data })

/** 创建地址池 */
export const addDnsAuthorityGtmAddressPoolApi: CommonAPI<
  '/v1/dnsauthority/gtm/address_pool',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/gtm/address_pool`, data)

/** 更新地址池 */
export const updateDnsAuthorityGtmAddressPoolApi: CommonAPI<
  '/v1/dnsauthority/gtm/address_pool',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/gtm/address_pool`, data)

/** 查询地址池 */
export const getDnsAuthorityGtmAddressPoolsApi: CommonAPI<
  '/v1/dnsauthority/gtm/address_pools',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/gtm/address_pools`, { params })

/**
 * @description: Node
 */

/** 获取 ns node */
export const getDnsAuthorityNodeApi: CommonAPI<
  '/v1/dnsauthority/node',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/node`, { params })

/** 获取 command */
export const getDnsAuthorityInstallCommandApi: CommonAPI<
  '/v1/dnsauthority/node/install-command',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/node/install-command`, { params })

/** 删除 ns node */
export const deleteDnsAuthorityNodeApi: CommonAPI<
  '/v1/dnsauthority/node',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/node`, { data })

/** 创建 ns node */
export const postDnsAuthorityNodeApi: CommonAPI<
  '/v1/dnsauthority/node',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/node`, data)

/** 更新 ns node */
export const updateDnsAuthorityNodeApi: CommonAPI<
  '/v1/dnsauthority/node',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/node`, data)

/** 注册 node */
export const postDnsAuthorityNodeRegisterApi: CommonAPI<
  '/v1/dnsauthority/node/register',
  'post'
> = data => defHttp.post(`/v1/dnsauthority/node/register`, data)

/** 升级 node */
export const updateDnsAuthorityNodeUpgradeApi: CommonAPI<
  '/v1/dnsauthority/node/upgrade',
  'put'
> = data => defHttp.put(`/v1/dnsauthority/node/upgrade`, data)

/** 查询 ns node */
export const getDnsAuthorityNodesApi: CommonAPI<
  '/v1/dnsauthority/nodes',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/nodes`, { params })

/**
 * @description: DNS 节点版本管理接口
 */

/** 获取节点版本详情 */
export const getDnsAuthorityNodeVersionDetailApi: CommonAPI<
  '/v1/dnsauthority/node/version',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/node/version`, { params })

/** 获取最新节点版本 */
export const getDnsAuthorityNodeVersionLatestApi: CommonAPI<
  '/v1/dnsauthority/node/version/latest',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/node/version/latest`, { params })

/** 查询上传解析结果 */
export const getDnsAuthorityNodeVersionUploadParseApi: CommonAPI<
  '/v1/dnsauthority/node/version/upload/parse',
  'get'
> = params =>
  defHttp.get(`/v1/dnsauthority/node/version/upload/parse`, { params })

/** 删除节点版本 */
export const deleteDnsAuthorityNodeVersionByIdApi: CommonAPI<
  '/v1/dnsauthority/node/version/{id}',
  'delete'
> = data => defHttp.delete(`/v1/dnsauthority/node/version/${data.id}`, { data })

/** 查询节点版本列表 */
export const getDnsAuthorityNodeVersionsListApi: CommonAPI<
  '/v1/dnsauthority/node/versions',
  'get'
> = params => defHttp.get(`/v1/dnsauthority/node/versions`, { params })
